package com.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONObject;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bean.PictureTag;
import com.dao.PictureTagDao;
import com.service.PictureTagService;
import com.util.LoggerUtil;

@Component("pictureTagService")
public class PictureTagServiceImpl implements PictureTagService {
	public static Logger logger=Logger.getLogger(PictureTagServiceImpl.class);
	@Autowired
	private PictureTagDao pictureTagDao;

	@Override
	public Map<String, Object> selectList(JSONObject logs) {
		Map<String, Object> map=new HashMap<String, Object>();
		try {
			List<PictureTag> data=pictureTagDao.selectList();
			if(data!=null&&data.size()>0){
				map.put("result", "success");
				map.put("rows", data);
				LoggerUtil.backlogsSuccess(logs, logger);
			}else{
				map.put("result", "false");
				LoggerUtil.backlogsFalseNOData(logs, logger);
			}
		} catch (Exception e) {
			e.printStackTrace();
			map.put("code", "101");
			LoggerUtil.backlogsFalseError(logs, logger,e);
			return map;
		}
		
		return map;
	}
	
	
}
